package com.cn.trip.service;


import com.cn.trip.DbDao.CartDao;
import com.cn.trip.bean.Cart;

import java.util.List;

public class CartService {
	
	public List<Cart> getCartList(int user_id) {
		CartDao cart=new CartDao();
		return cart.getCartList(user_id);
	}
	
	public boolean clearCart(int user_id) {
		CartDao cartDao=new CartDao();
		int flag=cartDao.deleteByUserID(user_id);
		if(flag>0)
			return true;
		return false;
	}
	
	public boolean deleteCart(int id) {
		CartDao cartDao=new CartDao();
		int flag=cartDao.deleteByID(id);
		if(flag>0)
			return true;
		return false;
	}
	
	public boolean  update(int id,int num) {
		CartDao cartDao=new CartDao();
		int flag=cartDao.updateNum(id, num);
		if(flag>0) return true;
		return false;
	}
	
}
